import { Inject } from '@midwayjs/core';
import { CoolController, BaseController } from '@cool-midway/core';
import { GoodsPriceEntity } from '../../entity/price';
import { GoodsPriceService } from '../../service/price';
import { UserInfoEntity } from '../../../user/entity/info';
import { GoodsInfoEntity } from '../../entity/info';

/**
 * 商品价格
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: GoodsPriceEntity,
  service: GoodsPriceService,
  pageQueryOp: {
    fieldEq: ['a.goodsId', 'a.priceLevel', 'a.status'],
    select: ['a.*', 'c.title as goodsTitle'],
    join: [
        {
          entity: GoodsInfoEntity,
          alias: 'c',
          condition: 'a.goodsId = c.id',
        }
      ],
  },
})
export class AdminGoodsPriceController extends BaseController {
  @Inject()
  goodsPriceService: GoodsPriceService;
}
